/*
 * Created by LiuYou on 2020/11/13.
 *
 */

#ifndef EFFECTIVECPP_INTELCPU_HPP
#define EFFECTIVECPP_INTELCPU_HPP


#include <ostream>
#include "Cpu.hpp"

namespace computer {


    class IntelCpu : public Cpu {
    public:
        friend std::ostream& operator<<(std::ostream& os, const IntelCpu& cpu);

#ifdef Flag

        const std::string& getCpuFeature() const override {

            ///
            std::cout << "getCpuFeature()调用VS" << std::endl;

            // TODO 这里不懂！！！
            // 返回父类的 cpuFeature。
            return Cpu::getCpuFeature();

            // 返回子类的 cpuFeature。
//            return getCpuFeature();


//            return std::string("Intel Cpu 高端CPU性能优越！");
        }

#endif

        const std::string& getCpuFeature() const override {
            return Cpu::getCpuFeature();
        }

        void setCpuFeature(const std::string& cpuFeature) override {
            Cpu::setCpuFeature(cpuFeature);
        }

        explicit IntelCpu(const std::string& cpuFeature) : Cpu(cpuFeature) {}

        ~IntelCpu() override = default;


    };

    std::ostream& operator<<(std::ostream& os, const IntelCpu& cpu) {
        os << static_cast<const Cpu&>(cpu);
        return os;
    }
}


#endif //EFFECTIVECPP_INTELCPU_HPP
